If you use functions to aid in abstraction, you can easily convert the function to a program in a more capable language as soon as it becomes too complicated.
In the end, I usually find that most of the things people replace good old unix tools with are better in one limited area, but miss a large part of what make the originals magic. Usually this is some combination of universal, discoverable, reduced dependencies, composable abstractions.
My bash-modules[0] project[1] may help you with that. Typically, I perform script refactoring in these steps:
1. Split code into few subroutines with clear boundaries between them, or split a large script into multiple simpler scripts.
2. Add an error handler with transparent message to every line of code.
3. Add command line options to override hard-coded things, to be able to test things in isolation.
4. Write documentation (man-page) for script, for future self.
5. Write test cases.
6. Refactor code, following best practices.
That's all fine and dandy until your shell script grows beyond a dozen lines of code or so. The moment that happens, shell scripts become barely readable and terribly hard to maintain, unlike alternatives such as python.