Added Xinjie's code.