Reorganized and added some classes and methods.