slight reworking of javascript feature toggle implementation