- properly accepts absolute paths
- made into a seperate function, to more easily merge into another file