Overhaul path functions

Better encapsulation. Allow colon in file path. Better tests.