More useful warnings and some clean-up