single stack

Instead of a firstStack and a lastStack, you can use a single stack which contains an object with first and last members, it seems to give a [modest boost](http://jsperf.com/simplify-stacks) to speed.