Vert sorting counterclockwise semi-working: having some issues

This approach might also be relevant: