Smarter path handling