Added inheritance. Some fixes.