update code to follow the plan