fix naming collision and change normal fn to generator fn