Move general array functions to helper file