Refactored settings to make testing in different environments easier; stop the HTTP server in more places