Added cache and tests