fixed issues with incrementing and looping not working properly. needs more tests