finalizing the code

debugging code for first alert and cleaning up all code