WIP getting closer, seems to work well for bash-based and native zsh versions