first draft of the genOut function