resolved errors in the code and updating the code