Tidying up, commenting, reducing line count
Add some header info, further tidying.