removed extraneous bits from original loop