Updated passGen function.