~ minor changes and documentation, code reordering