initial refactoring for switch to nginx proxy (#7)