Currently able to fill the matrix, was creating an iterator each tim in infinite loop. Code might need some refractoring.