some refactor on class hierarchy