Samples have been improved - more code

More code was added to give context to each example, including the
creation of objects needed for each example.