changed variables to be defined on the fly