refact controllers and views