dynamic caching

Much more object orientation in theme.js, added dynamic caching API to
theme.js