corrected errors and made some improvements