updated indexController to use if statements instead of Exceptions for flash Messenger