Major refactoring and cleanup to accommodate typed Ids.
Authored by: jwjoubert 2014-10-01
Parent: [r30445]
Child: [r30447]