Faster painting by detaching parent table first, exception handling.