caching

code more structured