added all_final
move prototype rw transaction code into separate file
some reindenting