Working on matrix reallocation