Refactoring web controller