adding global variables to constructor