Cleaned up cloud server code, added a few comments.