New class Dog added, code refactored