added orderBy and unit tests