refactored array and object