corrected and improved code