move javascript to internal