Add a stackSize return value to scan()