refactor printutils