Almost ready for the emailing
Code cleanup