Refactor out libraries to reduce code duplication and complexity
Fixed host header and added cookie whitelisting
Moved all middleware out
Update and cleanup tests
Added tests for broken services