1. refactor the log 2. refactor the KeyGroupIterator