working visualization demo, fixed some bugs