refactoring + improved logic

now progress is not 0 after the first iteration anymore