refactored cache paths
made into gem