WIP split up server code