Added some sorting functionality