Refactorise "Remove duplicate code"