refactoring controller
create functional test