CachedMatrix solution done