cleaned up mail processing