Moved Num_rows and Num_cols from global to local variables
Clean up