Refactor SVIs code to use S4 classes.