add some caching and speed it up
Merge pull request #3 from zsprackett/master

add some caching and speed it up