Bug fixes and interface improvements -- see the comments in individual changes