Updated register function too