Refactored and re-organized some classes.