JS console errors showing - had the object stuff declared too late