checked in some additions by Hao.