changed system to use vector instead of matrix