refactored code into dotenv