Module structure improvements

Mostly split up old *server.py* into several modules. Should be easier to navigate, test and maintain now.

*A lot of changes there, commit log might be helpful.*