code cleanup: update to the new js features