Changed one variable to provide invertible matrix cached