implemented all of the results queries. This now has same functionality as the non-sql version