Added mcvar functions for handling matrices