cleaned up and scrubbed this example code for publishing