better way to extract paths