Low-hanging performance improvements

First pass at performance improvements, cache multiply accessed items, makes about a 20% improvement on my machine (vs base)