refactory e debug