Improve naming and rearrange functions
WIP
Banish tmp_dir