Refactored business logic out of server code and updated comments
throughout the app.