refactor for get_path