semi-working stuff pulled from code.
Need to tidy it up a bit soon
Merge branch 'master' of https://github.com/xark-project/XARK-CORE