A few changes to the code