Cleanup and improvements to server