relay design refactoring