Did some cleanup and pulled out the run code into an example file