Remade program using classes.