some refactoring in accounts