Added functionality to append new rows or cols to matrix