Added credit to Bob for improving script