Sort working + tests