moving server code into app/server