Tidied-up. Removed unused data structures