trail refactor finished