Fix heading bug and add unit tests

Also smarter logic for heading wrap-around

Merge request reports

Loading