Removing some JS throwing an error