regression code working OK