Allowed querying using parent type and refactored test into a function.