Change spiral matrix implementation