added array checking; ensure that only elements of same type can be added to an array