Refactored a few server side things