redis storage and some refactors