Replaced boolean parameter with onLoop