passing state as arg