Debugged minor errors - doesn't fully run if GENERATE = False