Added diagonal sum, clumsy looking code