Refactoring without Angular