Made DiagonalUtil a little bit more flexible