use padarray instead of own method