Rewriting db formating where data is loaded from, for easier usage in
future. Some code cleanup.