Updated config.yml
Simplified code, added extra checks