update inheritance implementation to @joneslee85 suggestion