- Backport #1024 - Fixes #1025
- This is basically copy from main branch minus all terminal ui things. - Relates #971