Implement the relative path calculation