Refactored
Add support for 'orderby'