Initial attempt 1

This is the most stable version of XLG available but is only somewhat
changed since the last release. Refactoring and changes will be ongoing.