Cupcake upgrades

[placeholder until merge-ready]
I find function nesting inside for-loops to be more readable by creating an IIFE:
```js
// you may or may not need this semicolon depending on this functions location
;(function (i) {
  return function() {
    // i is properly set here
  }
})(i)
```