Cleanup, added previously missing references, general structuring