removed print_8bits debugging function. removed thread locks while setting state.