Updated to B13

Misc bug fixes and code improvements