Why not just do something like this then? This:
myfunction(data) {
# do one thing to the data
...
# now do another
...
}
becomes that: myfunction(data) {
do_one_thing_to_the_data(data)
now_do_another(data)
}
do_one_thing_to_the_data(data) {
...
}
now_do_another(data) {
...
}
Still linear, easier to get an overview, and you can write more modular tests.