Switched to `sh` interpreter and refactored code.