cleaned up client and server code, still doesn't work though