Finished port to ES2.0 but needs optimization in the stack stuff.