refactor base