wrap example in function; add doc strings