replace state with listener