servo code refactoring