moving controller from component to js