A number of fixes and cleanup

This has since changed -