Refactoring and some work on recoverx