added some override and fixed main