now works on files with 3 or more columns