moved elements to match the reorgnization and to give them a more logical order, and added some documentation