Code for step-3