Completed Code. V1