refactor - not much
moved link insertions to end of the file
missing java file