first step towards replacing single var fitting; all further commits will me merged