Avi's edit after code review

More details in error messages
a little documentation
Added constant for limiting number of links
function name refactoring