Add sort by functionality