add cache and tests