refactored cache method to work better with containers and also fast layers