found iterative solution