Fleshed out server logic