Added demo, fixed bugs