implemented functions and caching