Added optional redis save section
Refactored the whole thing and made it work with redis and multiple hosts.