Made some functions private + added comments in cache + removed some non-needed locks. Cache seems stable like this.