Made some cleanup to the code + better email message