TODO: - make a list of scenarios that need to be tested - write tests for all scenarios on the list - this will probably require a pidfile-writing feature for the server to make sure we don't leave it running forever