merging in a bunch of mail changes from 247 project