Refactoring of data structures and initial XY graph support