Fixed parsing of file, ready for large scale