nearly there for matrices