Minor code re-organization