Modififed doit: something seems to work