Somehow this function got deleted, so I am re-inserting it.