refactoring error and warining messages