#6154: Refactor as Jorge suggested