refactoring config check a little