refactored diagonal