Updated problem 4 to not have null pointer error