add caching and credential validation