Improved generic method detection and replacing.