Complete register function