refactoring + logger + debug + cache