More work on cache logic