Refactor app layer functions
Fix typo
Improve preparing cache