redo JS checks so that appropriate code block is run depending on the corresponding html
updates