code refactoring: move logic to store