Finish register function.