Merge from Tianyi

Tianyi, please review this commit for accuracy.  This is a merge from your master.