removed unnecessary matrix math and updated var names