Added the Final Code