changed order of function constructor