tidied up examples. still lots of optimization to be done