Refine the code according to Anoop's comments.