Fixes to make it work.

Better comments to stop me getting tangled in XML elements
Also has a main now