Refactor link type determination 2