Various small changes and bug fixes.