Array validation added. Not tested