main controller working