Updated example, added loops