started refactoring of 2 dimensions into array