moved reg func