Rewriting server to become more modular