refac function registration