optimize code
update change detection