use let instead of nested fns in gen-plan. Results in cleaner code/debugging.