incorporate review comments from Yakov Rehkter