changing sorting to use $parse.