Fixed the bug, now the n x n case is now doable.