Slightly modified registration function