Add Mail logger
Refactor a bit