chopping off unnecessary path