More refactoring done inside controller