Moved duplicate code into common role