clean unused code, utilize pathlib better