refactor wallet