This is one of the ugliest functions I've ever seen. :smile: 
Perhaps we could remove the underscores everywhere and put a couple of newlines in?