I find the contents of this function fairly scary (the innerHTML manipulation) can you explain whats going on here?