working triangle sorter with page