adapt according to mvidner comments