refactoring
modified controller