moved main out of controller