Split server code into its own thing