add mail module and small cleanups all over