Optimisation, arrayfication, non fuctional version