Refactor redis handling.