Refactoring Code, Adding a Basic Cache