Threading autofit - seems to be working

@nikgraf @dmitryevseev please if you have some time can you have a look at this one?