added the keep matrix