made some changes

comparison with matrix method