Fix issue with linking and remove the insane code.