Added guard and rspec
added error handling and other fixes to modals