state should be passed a pointer