Replacing yield with return