Modified code to use override keyword