factor the print method better.