Data structures refactor