- fixed and tested sorting