major rework on all data structures, fully id-based