incorporated timm's fixes