Rewrote most data parsing functions. Should be more robust now.