Refactoring in local characteristics calculator.

Also updated npgsql to 2.2.1.0.