refactored first 4 problems & separated each problem to separate object