Split server.cpp to multiple files

Moved lots of code from server.cpp to separate files, yet server.cpp remains a huge file