I don't think you asked an actual question. Did you discover a specific problem with this or are we just looking at what you wrote?
CheckArray() will be an important function because you said that...