Improvements and general bug fixes.