[Minor] Refactoring to avoid duplicate code

Very merry end of the year :)