Adding setSort() tests and cleaning up an edge case