Added Email Agent

Also fixed some other minor errors and added comments for alerts