removed tw_state_alloc, put relevant code it tw-lp.c