Wrote tests for the server and fixed some bugs.