Making 'db' a variable local to the function, for a minor bit of safety. Also correcting the printing of the collection name, moving it inside the if() statement, so I don't see something untrue, such as 'we will now empty this collection: system.indexes'