bug628796: considerably improved performance and logging