added orderBy function to use it instead of asc and desc in query sorting