fully working parsing code for data files

not cleaned up but it works at the moment