updating code logic