Corrected code errors and tested with success