My final solution was found on Stack Overflow
function . . .
Cover image credit: http://whoiskevinrich.com