rewrote data structures