elastic refactored