Added generator function