Pattern matching in the server module I had made was not very good. Attempting a finite state machine approach inspired by the book 'Learn You Some Erlang for Great Good!'