refactor Serve command to move out server setup