Refactored link establish and teardown as suggested