Finished alert function and added a confirm