refactoring and e2e mock