needs to add ordering and group by functionality