refactoring and improve console message