extracted server related stuff to a seperate module -

todo - extract further into a library