moved to using a lambda for clarity as per @ehebert