[2693] Added sorted function and changed tests

Are you using the variable anywhere now?