Added validations for array creation and access