Committing code before trying to fix stack problem in driver code.
Fixed JS recursion stack issue by making the runMultipleEvents function iterative instead of using CPS.