now works with arbitrary size braid matrices