Cleaned up server code in preparation for next phase