completed JS working vers