refactored array addition