Explained attachHeads
Implemented maximaBy