refactor: move definition to inner scope