Updated query function to take an object instead of multiple arguments. This is so we can pass optional arguments and have a richer interaction. Updated the query to allow re-running of specific errors.