add Register class and three exception classes.