Added function to count diagonals. Could still be improved