Refactor out link and node states to be more modular.