sets delegate in constructor function