update function converted(untested) + hasClass