Updated queries: parameters added to the queries and fully implemented the required queries.