Problem #4 code added; Not tested;