move regspec function to separate module