added 'cleanpath' helper function