Loop changes

Simplified after our discussion in #shopp