change matrix building method done