Refactoring common code.