Refactored arrays into objects