Removed bug and improved example