added comments, refactored link index