also found quite a few cases where variables were used that hadnt been defined.
(First commit! Let's hope this works!)