improved example and cleaned up code a little