Added encapsulation to the existing postgresql templates