Factored out some warnings and made them more informative