Refactoring:

- on final row, return head instead of max
- renamed variable