Changed the order of the checks, trying to implement 2d arrays