First code

Jiakui's contribution.