Simplified problem 1 and removed unnecessary method.