Please review the attached patch for:

This patch has been tested with both GUI and non-GUI configurations.