better comments and minor code style format