pseudo code for algorithm in comments
implemented algorithm. Works perfectly for printing inline links