[UPDATE] reorganized. Demo code. [FIX] various bugs.