Initialized K matrix and a couple other variables