modified reverse fn
modified links.h