adding support for order by function query