implemented comments from @iguananaut