optimisation: array as data structure
dito