corrected and tested