Better printing logic