refactoring and export arrayify function
update doc