Server rewrite - closes #17

still WIP