Tests and sort