rewritten without interators