It is quite tricky to see how the behavior still stays identical (not masking it in finally, see comment on later lines), so could this be simplified somehow.