refactored for env variables