Started using templates, and also checking the type when pulling the array object.