Fixed up server code and added exceptions