clean code in matrix
add integrals