working iteration, added forgotten parts