adding order by functionality