refactor controller and javascript