Lots of small improvements and reference file