refactored parsing the data