Fixes by the gentleman @brendo
Code tidy
Last few tweaks I hope