Reworked final solution. Re-implemented the array of cells structure