Added array checking