improved the example code a bit