finished this interesting example and added some nice code