generate register function