Some changes to make code run correctly