adding success and failure modals logic