stable version with inheritance