Refactor print