report printing and html emails refactored.