Refactored to use a query_conditions function to populate properties for the while_state functions to evaluate rather than querying components in the while_state functions.