Worked on link function and cleaned up comments