refactor legacy fallback to separate function