update code logic