added print_state method