refactor how variables are set