update removing code, and using state