sorting of corners