minor refactor for production mode