validate config and test for it
exception with more information and delete second key checking
small refactoring