JS tidying, failsafes
More JS tidy, faster loading!