finished implementing matrix transformation