Updated changes from David Tao