Major refactoring of packages and classes.