Refractoring print messaget and some small changes