Fixed #1 - better sorting