minor changes in example (moved a few things around)
moved functions from example to directory