refactor store, reduce code