refactor test server stuff