Refactor resent section to use loop instead of a fixed array