Refactored the server a bit to generalize packet handling