Bool guard function instead of closure for return/otherwise might trigger unwanted side effects or increase computation costs