modify to refactor relation type patterns