Add examples following godoc convention, fix bug