importing Eric Jones' blog code and modifying it to suit us
cleaning up and adding a couple of examples