Fixes to all sorts of stuff. Working from the bottom up