added mat_file functionality