spliting server logic into its own file