Reupdated to Sen Li's version of the code.