Final Code (Without Comments)