final revision of both the code and problem statement