Refactor to support ChocolateChipJS.

Many of the recent new features were not working with ChocolateChipJS
due to differences in handling dimensions, each iteration, etc.
Merge pull request #87 from sourcebits-robertbiggs/master

Refactor to support ChocolateChipJS.