Some work on the data parsing, needs refactoring.