Some minor changes to make the code cleaner