refactored javascript to relfect HyperLinked relations