Refactor grain report into functional style