Cleaning up generation and reading back of lookup tables. Also moved core generation...