Finished register function