Please extract the credentials map once and re-use it, rather than re-traversing the hash three times.