moved the function to top-level jquery rather than on elements - it does not really interact with elements anyway