Moves some attr assignments out one scope
Moves some attr assignments out one scope

- It also worked when I took it out of the for loop, but that
doesn't make sense because I didn't change variable names and it
still worked even though the variables weren't in the right scope
anymore... so I changed it back...

omriBernstein/qromp