CED Example improvements

Code reorganisation and small bug fix.