I want to add into my previous post, since I’ve already found how to deal with my issue.
Looking through the forum I found How can I detect the direction a link is being travelled? - Beginner Questions - Support Forum. In the post it’s clearly explained how to iterate through the PathParts and cast the proper parts into NodeLinks if needed.
I’ve just adapted my code based on that response and it seems to work perfectly. Thank you once again for the help!