Added a proper warning dialog instead of using a Messagebox
Added some comments