Refactored javascript, added link deletion