Reorganized functions to limit the redundancy. No functionality change.
Authored by: balacm 2014-05-20
Parent: [r29015]
Child: [r29017]