dynamic refactor