Make sort criteria a variable