Adding the completed code