Some fixes, adding and fixing a bunch of tests
Refactor `optimize`
Fix comment
Gets a test passing on IE10