trying new reg generation routine