fixed big bugs and added a new example