Added nicer alerts via alert event.
Prevent save when there are errors in the code