Added try catch blocks so that client timeouts will not take down the server