Updated to use some reflection helpers.