Added working version of encapsulation class and added methods needed in SQL function class