minor code re-organization