optimizing data structure