Removed the SQL queries for count methods
Fixed SQL in reports and refactored to sql file