Some code reorg..