added support for sorting