Tidied up example code