Adding links, and cleaning up code