simple solution with loop, violates a lot of SOLID priciples