move iterations loop from java to python ... still need to fix var names