added new js state variables to context, fixed some js syntax errors