cleaned up the example code a bit