updated addLinks function to work in firefox