add function handling in print_table