Modularize server and test