Low-hanging performance improvements

First pass at performance improvements, cache multiply accessed items, makes about a 20% improvement on my machine (vs base)
Merge pull request #37 from TheBosZ/master

Low-hanging performance improvements