Added Lu's new code, fixed some bugs with it, added new UIs.