moved registration function