Created an execute query method