Refactoring data structure