DDF-565: Added logical checks to link generation
DDF-565: Refactored code
DDF-565: Replaced string arguments with constants