Refactor Environments and ServerInterface.