revised with multiple inheritances