Feature #5157 - Adapting some code.