Added a sort and double functionality