Creating singletons thread safe. Trying to figure out why repository is so slow.