Move add_num_to_path out to util
BIG refactor

Should have been smaller commits, but too much going on
Add headers