Fixes javascript to not stack overflow and improves js pipeline