WIP
refactor server into a module