Add relay module and refactor attribute logic