refactoring variant c and d