Simplified implementation of 'reg'