Use closure instead of CS generated JS (closes #138)