Refactoring printing to be neater