Tidied up the example code