data structures almost finalised