improved codes in 'print_all.py'