Fixing bug in the example and consolidating it.