Adds error handling and changes modal
Modal now pops up when needed (not from button)