switched to two dimensional array and working now on logic