Slight bugfix.
Integrated Brian and Shufei's front-end work.
Fixed some bugs.