refactor analsis to be more testable, isolating redis to fewer methods