Refactoring, simplification, better print_*