Moved code from reference to examples