Fixes #5 store template in cache and use if necessary