Cleaned up server side code, added SocketHandler object for better structure