Some code cleanup v2