Change the data structure as suggested by dr-leo.