working iteration, minor changes