3 different links, and some restructuring of the code