added if conditions and array object