cleaned up matrix