Added example and tidy up of debugging.