const modification
big refactor, added caching capacities
implemented cache