reworked link cleaning algorithm, added options, bugfixes