queries now align with style guide, is > ==, tried to refactor error handling