Refactoring to more cleaner patterns