code ready for embedding in documentation