Implemented state_id managment