register function works