refactor the printing statements
merged