cleanup main controller