End code for registration