adds explain functionality and moves generator helper functions to own
file