added order by functionality