Modify data structure and optimization