refactored server/client to single class (per feedback from nbenns)