refactoring etcds functions