add caching and threading structure