added procedures sortATPAFromFirstPointX / Y.