Data dir

Refactor, simplify and add a unittest to the data_dir lib.

Also, introduce a `get_data_dir()` function.