Improved handling of CCJ_PRODUCTION environment variable and a small refactoring.