Complete register function.