Cleaned up SpiralMatrix implementation.