Refactor dat-files