added a generic execute query function