Refactored server code to remove fluff