Further implementation of DataParser

This consolidates the code and ensures consistency. Before, we had a lot
of duplicated or inconsistent code.
Method moved to ui.js
Merging