Added auto registration function