Finish register function