made parameters var global for debugging (so I could access in js console).