added constructor function for function type