Fix dead code and links