add improved class hierarchy

-code duplication