remove global $CONFIG and fix edit link

a bit of code cleanup as well.