tidy up and add code examples