updated a way of controller working