changing matrix definition
minor edits