cleanup of Emailhandler code