Refactor code for Pad Array