Refactors parseData