moved cache to a require, and refactored functions names