Corrected warnings, and made minor improvements