Improved Link Tool

Fixed link tool errors and cleaned up code.