modified according to George's comments