use checkFileType in automatic renaming
update links to correct page
clean code