MAPREDUCE-5809: refactoring and comments