refactored stuff into server so threading and forking is easier