added a function that I found that is a great answer