Better handling of various query inputs, and queries which fail