making better usage of arrays