Compartmentalized JS functions