reworking js data handling