refactoring webapp