Moved out non-server related things to separate source files.