clearer (more efficient?) to create function closure outside of transaction retry loop; type switch is more pleasant than type assertion
formatting fixes to make the example program look even more better on github