Optimizations

I optimized a few things. However I did use `Array#indexOf` which isn't available in all versions of IE. I was going to rectify that, but I'm not sure when. Here's something to think about.