Added calculations for Option 2 and fixed js lint errors for variable definition.