optimising the arrays