Replace hardcode with loop