changed js to avoid global namespace