Minor code reordering