add flag + procedure as suggested by Kai-Uwe