refactoring code. Using environment variables for dev_id and app_id