Added tags to end brackets in Matrix