More changes to test retrieval query, logic on states/statuses not correct