refactored get_diagonals