started moving away from globals for increased testability