clean code and trying solve matrice issue