Reworking JS interaction