https://idlgemslab.com/diamond-sorting/