almost done, need to fix the next line issue and to test on lots of files