added controllers and modified flow