Reverted to foreach, but set isprocessed before handling the callbacks