Added send mail functions and cleaned code