improved paths and pathinfo
refactoring and cleanup