Various changes

1. pulled some method-scoped objects out to static members to avoid
creating/destroying every cycle.
2. moved the tv on threshold value out to app.config