Fix comments and cleanup code