update flash functionality by putting messages in controller
refactor and clean up code