links added and more refinement in code