refactoring to remove all variables and use env variable