Conditional statement added in Problem 6