Bug fixes and some cosmetic changes.